package com.xm;

public class Enum03 {
    public static void main(String[] args) {
        System.out.println(MyEnum.FIRST);
        System.out.println(MyEnum.FIRST.getDescription());

        MyEnum.FIRST.setLastName("Tony");
        System.out.println(MyEnum.FIRST.getLastName());

        System.out.println(MyEnum.FOUR.getDescription());
        System.out.println(MyEnum.FIVE.getDescription());
    }
}

enum MyEnum {
    /*
    相当于调用了构造方法
    public static final MyEnum FIRST = new MyEnum("第一个");
    public static final MyEnum FOUR = new MyEnum();
    */
    FIRST("第一个"),
    SECOND("第二个"),
    THREE("第三个"),
    FOUR(),
    FIVE;

    private String description;

    MyEnum() {
        System.out.println("---");
    }

    MyEnum(String description) {
        this.description = description;
    }

    public String getDescription() {
        return description;
    }

    private String lastName;

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;

    }

}
